d02bhf

d02bhf © Numerical Algorithms Group, 2002.

Purpose

D02BHF ODEs, IVP, Runge-Kutta-Merson method, until function of solution is zero (simple driver)

Synopsis

[x,y,tol,ifail] = d02bhf(x,xend,y,tol,fcn,g<,hmax,irelab,ifail>)

Description

 
 The routine advances the solution of a system of ordinary 
 differential equations
 
               y' =f (x,y ,y ,...,y ),  i=1,2,...,n,
                 i  i    1  2      n
 
 from x = X towards x = XEND using a Merson form of the Runge-
 Kutta method. The system is defined by a subroutine FCN supplied 
 by the user, which evaluates f  in terms of x and y ,y ,...,y , 
                               i                    1  2      n
 and the values of y ,y ,...,y  must be given at 
                    1  2      n                 
 x = X.
 
 As the integration proceeds, a check is made on the function 
 g(x,y) specified by the user, to determine an interval where it 
 changes sign. The position of this sign change is then determined
 accurately by interpolating for the solution and its derivative. 
 It is assumed that g(x,y) is a continuous function of the 
 variables, so that a solution of g(x,y) = 0 can be determined by 
 searching for a change in sign in g(x,y).
 
 The accuracy of the integration and, indirectly, of the 
 determination of the position where g(x,y) = 0, is controlled by 
 the parameter TOL.
 

Parameters

d02bhf

Required Input Arguments:

x                                     real
xend                                  real
y (:)                                 real
tol                                   real
fcn                                   function (User-Supplied)
g                                     function (User-Supplied)

Optional Input Arguments:                       <Default>

hmax                                  real     0.0
irelab                                integer  0
ifail                                 integer  -1

Output Arguments:

x                                     real
y (:)                                 real
tol                                   real
ifail                                 integer